package com.ibm.mall.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibm.mall.dao.AdministratorDao;
import com.ibm.mall.model.Administrator;
import com.ibm.mall.model.PageBean;
import com.ibm.mall.service.AdministratorService;
import com.ibm.mall.util.QueryHelper;

@Service
@Transactional
public class AdministratorServiceImpl implements AdministratorService {
	@Resource
	private AdministratorDao administratorDao;

	@Override
	public void save(Administrator administrator) {
		administratorDao.save(administrator);

	}

	@Override
	public List<Administrator> getAllAdministrator() {

		return administratorDao.findAll();
	}

	@Override
	public void updatAdministrator(Administrator administrator) {
		administratorDao.update(administrator);

	}

	@Override
	public Administrator getAdministratorById(Integer id) {
		return administratorDao.getById(id);
	}

	@Override
	public PageBean getPageBean(int pageNum, int pageSize,
			QueryHelper queryHelper) {
		
		return administratorDao.getPageBean(pageNum, pageSize, queryHelper);
	}

	@Override
	public Administrator getAdministratorByUserAccount(String username) {
		return administratorDao.getAdministratorByUserAccount(username);
	}

}